package study.spring.mvc.nouseservlet;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

@ComponentScan(basePackages = "study.spring.mvc.nouseservlet")
@Configuration
public class SpringMvcNoWebConfig {

  /***配置视图解析器*/
  @Bean
  public InternalResourceViewResolver viewResolver() {
    InternalResourceViewResolver internalResourceViewResolver = new InternalResourceViewResolver();
    // 前缀
    internalResourceViewResolver.setPrefix("/WEB-INF/view/");
    // 后缀
    internalResourceViewResolver.setSuffix(".jsp");
    return internalResourceViewResolver;
  }
}
